﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using OVS_NotificationSender.Manager;
using OVS_FormsRecognition.Manager;
using OVS_Tools;

namespace OVS_NotificationSender
{
    /// <summary>
    /// Logique d'interaction pour NotificationSenderMain.xaml
    /// </summary>
    public partial class NotificationSenderMain : Window
    {

        /// <summary>
        /// Logger par défaut du ManagerUtilisateurs
        /// </summary>
        private static readonly log4net.ILog _Log = log4net.LogManager.GetLogger(typeof(NotificationSenderMain));


        public NotificationSenderMain()
        {
            InitializeComponent();

            FormsRecognitionManager.Instance.NotificationSenderEventStart += new FormsRecognitionManager.NotificationSenderEventHandler(CallBackNotificationSenderEventStart);
        }

        /// <summary>
        /// Calls the back size calculation start event.
        /// </summary>
        /// <param name="nullObject">The null object.</param>
        /// <param name="pSizeCalculationEventArgs">The <see cref="SizeCalculationEventArgs" /> instance containing the event data.</param>
        private void CallBackNotificationSenderEventStart(object nullObject, NotificationSenderEventArgs pSizeCalculationEventArgs)
        {
            UIThreadHelper.UIThread(this, delegate
               {
                   _Log.Debug("new event CallBackNotificationSenderEventStart !!!");

                   if (labelLastAlertInfo != null)
                   {
                       String strDate = String.Format("{0:d-M-yyyy HH:mm:ss}", DateTime.Now);
                       labelLastAlertInfo.Content = String.Format("New Alert: camId: {0} date: {1}", pSizeCalculationEventArgs.id_alert  ,strDate);
                   }
               });

        }
    }
}
